package cn.kgc.springmvc.day03.controller;

import cn.kgc.springmvc.day03.entity.ResponseResult;
import cn.kgc.springmvc.day03.exceptions.ParamException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 课工场
 * @date 2024/5/7
 * @description
 *
 * @RestController = @Controller + @ResponseBody
 */
// @Controller
// @ResponseBody

@RestController
@RequestMapping("student")
public class StudentController {

    // 删除
    @RequestMapping("delete")
    public ResponseResult deleteUser(Integer id) {

        if (id<0){
            throw  new ParamException("参数异常");
        }
        return  new ResponseResult().setCode(0).setMessage("数据删除成功,id="+id);
    }


}
